<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 流年 <liu21st@gmail.com>
// +----------------------------------------------------------------------

// 应用公共文件
/**
 * ajax返回信息
 * @param integer $code 状态码
 * @param string $msg 提示信息
 * @param array $obj 返回数据
 * @param integer $total 数据条数
 * @return \think\response\Json
 */
function ajaxReturn($code, $msg, $obj = null, $total = null)
{
    $tmpArr = [
        "code" => $code,
        "msg" => $msg,
    ];
    if ($obj) {
        $tmpArr['obj'] = $obj;
    }
    if ($total) {
        $tmpArr["total"] = $total;
    }
    return json($tmpArr);
}
